package models

import "time"

//聊天记录
type History struct {
	Question string `json:"question"` //内容
	Answer string `json:"answer"`
	CreatedAt time.Time `json:"created_at"`
}

var (
	historyList = make([]History, 0)
)

func HistoryAdd(question, answer string)  {
	historyList = append(historyList, History{
		Question:      question,
		Answer:answer,
		CreatedAt: time.Now(),
	})
}

func HistoryLast() string {
	len := len(historyList)

	for i:= len-1; i>= 0; i-- {
		return historyList[i].Question
	}

	return ""
}


